<?php
 include('../php_includes.php');
	//require_once 'admin_options.php';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!--Page display the employees of the manager whose is currently login. If the manager has no employees,
    then the selection box will inform the manager. One selection box displays manager's employee while the
    other selection box displays other managers. The form will let manager to change their employees's to
    another manager once form is submitted.
-->

<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <title>Payroll and Timesheet Management Website</title>
    <link rel="stylesheet" type="text/css" href="adminStyle.css"/>
	<script type="text/javascript" src="pwcheck.js">
	</script>
  </head>
  <body>
  
	<?php writeHeader(); ?>
        <div class="links">
        <a href="adminMessage.php">Message | </a>
        <a href="adminManager.php">Change Employee's Manager | </a>
        <a href="adminDeletion.php">Delete and Transfer</a>
        </div>
      <p></p>
     <div class="center">
		<p>
     <span class="pageheader"> Admin Change Employee's Manager </span>
     </p>
     </div>
     <p> <br /> </p>
     <form action = "adminChange.php" method = "post">
       <div class="center">
        <select name = "Employees">
        <?php 
           sqlConnect();

           $mgrEmployees = 'select EmployeeID,EmployeeFName,EmployeeLName FROM Employee WHERE EmployeeID NOT IN (select distinct(ManagerID) from Employee)';
           $result = sqlQuery($mgrEmployees);
           $Row = mysql_fetch_row($result);

        do{
            echo "<option value = '$Row[0]'> $Row[0]  $Row[1]  $Row[2] </option>";
            $Row = mysql_fetch_row($result);
          }while($Row);
        ?>
        </select>
        <select name = "Managers">
        <?php 
           sqlConnect();

           $managers = 'select EmployeeID, EmployeeFName, EmployeeLName FROM Employee WHERE EmployeeID IN (select distinct(ManagerID) from Employee)';
           $theResult = sqlQuery($managers);
           $theRow = mysql_fetch_row($theResult);
     
        do{
            echo "<option value = '$theRow[0]'> $theRow[0]  $theRow[1]  $theRow[2] </option>";
            $theRow = mysql_fetch_row($theResult);
          }while($theRow);
          sqlExit();
        ?>
        </select>
        <p>
             <input type ="hidden" name = "hide" value = "hidden"/>
             <input type ="submit" value = "Change Manager" class="button"/>
        </p>
         </div>
        </form>
         

</body>
</html>
	